#include <iostream>
#include <ctime>
#include "thread_pool.h"
#include "sync_vector.h"
#include "obejct_manager.h"
#include "traits.h"
using namespace std;
class TestMem
{
public:
    TestMem() {};
    ~TestMem() {};
    void test()
    {
        // cout<<"esfd"<<endl;
    };
    char a[1023];
};
void test_mempool()
{
    if (RemoteObj::IsClassT<TestMem>::Yes)
      cout<<1<<endl;
    RemoteObj::MemoryPool mp;
    int  i = 0;
    int64_t count = 100;
    TestMem * tm;
    clock_t st, et;
    st = clock();
    for(i = 0; i < count; i++)
    {
        tm = RemoteObj::ObjectManager<TestMem>::Create(mp);
        tm->test();
        RemoteObj::ObjectManager<TestMem>::Delete(mp, tm);
    }
    et = clock();
    cout << (et - st) << " millisecond" << endl;
    st = clock();
    for(i = 0; i < count; i++)
    {
        tm = new TestMem();
        tm->test();
        delete tm;
    }
    et = clock();
    cout << (et - st) << " millisecond" << endl;
}
int main()
{
    test_mempool();
    cout << "Hello world!" << endl;
    return 0;
}
